<template>
  <div>
    <el-button type="primary" @click="gotoAdd">添加</el-button>
    <el-table
      :data="data"
      border
      style="width: 100%">
      <el-table-column
        fixed
        prop="id"
        label="ID"
        width="150">
      </el-table-column>
      <el-table-column
        prop="pageName"
        label="名称"
        >
      </el-table-column>
      <el-table-column
        prop="pageType"
        label="类型"
        >
      </el-table-column>            
      <el-table-column
        fixed="right"
        label="操作"
        >
        <template slot-scope="scope">          
          <el-button type="text" size="small">
            <router-link v-if="scope.row.pageType==1" :to='"/pages/config/"+scope.row.id'>配置</router-link>
            <router-link v-if="scope.row.pageType==2" :to='"/pages/formconfig/"+scope.row.id'>配置</router-link>
          </el-button>
          <el-button type="text" size="small">编辑</el-button>
          <el-button type="text" size="small">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <router-view></router-view>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  async created(){
    var url='http://localhost:8811/api/dynamicpage/getall'
    await axios.get(url).then(rep=>{
      this.data=rep.data.result
    })
  },
  methods:{
    gotoAdd(){
      this.$router.push('/pages/Add')
    }
  },
  data(){
    return {
      data:[]
    }
  }
}
</script>

<style>

</style>